from mall_admin.celery import app
from ronglian_sms_sdk import SmsSDK
from django.conf import settings
import json

@app.task
def send_message(sms_code, mobile, expire=5):

    sms_sdk = SmsSDK(accId=settings.ACCID, accToken=settings.AUTHTOKEN, appId=settings.APPID)
    tid = '1'
    datas = ("%s"%sms_code, "%s"%expire)

    res = sms_sdk.sendMessage(tid, mobile, datas=datas)

    res = json.loads(res)

    return res
